package com.ccloud.auth.core.handler;

import lombok.extern.slf4j.Slf4j;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import org.springframework.stereotype.Component;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 认证失败处理器
 *
 * @author scylla
 * @version V1.0
 * @project ccloud-parent
 * @title 认证失败处理器
 * @package com.ccloud.auth.core.handler
 * @since 2022/3/23 9:57 上午
 */
@Component
@Slf4j
public class CAuthenticationFailureHandler implements AuthenticationFailureHandler {


    /**
     * 身份验证成功
     *
     * @param request   请求
     * @param response  响应
     * @param exception 认证异常
     * @throws java.io.IOException IOException
     * @throws ServletException    Servlet异常
     */
    @Override
    public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException {
        exception.printStackTrace();
    }
}
